package com.nuanshui.heatedloan.task.facade.bean;

import org.apache.commons.lang3.StringUtils;
import org.springframework.util.Assert;

import java.util.HashMap;

/**
 * 定时任务需要传入的参数
 * @param 
 * @author guohao
 * @date 2017年1月3日 下午12:05:46
 * @since $
 */
public class JobParams extends HashMap<String,Object> {
	
	public static final String JOB_NAME = "JOB_NAME";
	
	public static final String JOB_GROUP = "JOB_GROUP";
	
	public  static final String JOB_CODE ="JOB_CODE";
	
	public static final String BIZ_KEY = "BIZ_KEY";

	public static final String ORDER_NUM = "ORDER_NUM";
	
	public void setBizKey(String bizKey) {
		this.put(BIZ_KEY, bizKey);
		
	}

	public String getBizKey() {
		String bizKey = this.getAsString(BIZ_KEY);
		if(StringUtils.isEmpty(bizKey)) return "";
		return bizKey;
	}
	public void setJobCode(String jobCode) {
		this.put(JOB_CODE, jobCode);
		
	}
	
	public String getJobCode(){
		return this.getAsString(JOB_CODE);
	}

	public void setJobName(String jobName) {
		this.put(JOB_NAME, jobName);	
	}
	
	public String getJobName() {
		return this.getAsString(JOB_NAME);
	}
	
	public String getJobGroup() {
		return  this.getAsString(JOB_GROUP);
	}
	
	public void setJobGroup(String jobGroup) {
		this.put(JOB_GROUP, jobGroup);
	}

	public JobParams addAttribute(String attributeName, Object attributeValue) {
		Assert.notNull(attributeName, "Model attribute name must not be null");
		put(attributeName, attributeValue);
		return this;
	}

	
	

	
	public boolean containsAttribute(String attributeName) {
		return containsKey(attributeName);
	}
	
	public String getAsString(String name) {
		Object object = this.get(name);
		if(object == null)return null;
		return String.valueOf(object);
	}
	
	

}
